package com.ayn.aynsystem.config;


import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author Ayn
 * @date 2022/5/13 14:49
 */
@Configuration
@EnableSwagger2
public class Knife4jConfiguration {
    @Bean
    public Docket petApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                //指定从那个包下面开始扫描注解
                .apis(RequestHandlerSelectors.basePackage("com.ayn"))
                .build();
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("api文档")
                .version("1.0.0")
                .termsOfServiceUrl("localhost:8080/swagger-ui.html")
                .description("测试")
                .build();
    }

}
